Fix static analysis defects
authorJohn Tsichritzis <[email protected]>
Thu, 16 Aug 2018 13:37:40 +0000 (14:37 +0100)
committerJohn Tsichritzis <[email protected]>
Wed, 26 Sep 2018 13:12:29 +0000 (14:12 +0100)
Fixed a Coverity defect by adding a runtime check to avoid potential
NULL pointer dereference.

Change-Id: I9a0aa0efd27334131ac835b43348658b436c657d
Signed-off-by: John Tsichritzis <[email protected]>
plat/arm/css/sgi/sgi_image_load.c

index dda5e96c529bdc29ed21c5d5e74105391d94fa5c..09403f8846ee8136fc8d2a9edc099de6eff843fc 100644 (file)
@@ -39,10 +39,15 @@ static int plat_sgi_append_config_node(void)
 
        platform_name = (char *)fdt_getprop(fdt, 0, "compatible", NULL);
 
+       if (platform_name == NULL) {
+               ERROR("Invalid HW_CONFIG DTB passed\n");
+               return -1;
+       }
+
        if (strcmp(platform_name, "arm,sgi575") == 0) {
                platid = mmio_read_32(SSC_VERSION);
        } else {
-               WARN("Invalid platform \n");
+               WARN("Invalid platform\n");
                return -1;
        }